<template>
	<view class="page-content">
		<view class="person-msg">
			<view class="swiper-box">
				<u-swiper :list="formdata.workInfo.split(',')" :circular="false" :effect3d="true" :autoplay="false"
					bg-color="transparent" height="492" mode="none" effect3d-previous-margin="128"></u-swiper>
			</view>
			<view class="person-msg-content">
				<image class="person-pic" :src="formdata.photo" mode=""></image>
				<view class="person-name">
					{{ formdata.name }}
				</view>
				<view class="person-age-sex">
					<text>{{ formdata.age }}岁</text>
					<text>{{ formdata.gender === 0 ? "男" : "女" }}</text>
					<text>专业送葬师</text>
				</view>
				<view class="person-desc">
					{{ formdata.remark }}
				</view>
			</view>
		</view>
		<view class="bottom-box">
			<view class="group_5">
				<text class="text_8">￥</text>
				<text class="text_6">{{ formdata.fees }}</text>
				<text class="text_9">/公斤</text>
			</view>
			<view class="chat-btn" @click="handleToChat(formdata.userId)"> 聊一聊 </view>
		</view>
	</view>
</template>

<script>
	import petFuneral from "../../../../api/petFuneral.js";
	export default {
		data() {
			return {
				list: [],
				formdata: {
					name: "",
					age: "",
					photo: "",
					fees: "",
					workInfo: "",
					gender: "",
					remark: "",
					jobType: 0,
				},
			};
		},
		onLoad(option) {
			this.getDetail(option.id);
		},
		methods: {
			getDetail(id) {
				petFuneral
					.getPetFuneralById(id)
					.then((res) => {
						if (res.code === 200) {
							this.formdata = res.data;
						} else {
							uni.showToast({
								title: "请求失败",
								icon: "none",
							});
						}
					})
					.catch((err) => {
						uni.showToast({
							title: "请求失败",
							icon: "none",
						});
					});
			},
			handleToChat(id) {
				uni.navigateTo({
					url: '/pages/news/user-chat/user-chat?userId=' + id
				})
			}
		},
	};
</script>

<style lang="scss" scoped>
	.page-content {
		width: 100%;
		height: 100%;
		background: linear-gradient(180deg,
				#fcd610 0%,
				#ffffff 50%,
				rgba(252, 214, 16, 0) 100%);
		display: flex;
		flex-direction: column;

		.person-msg {
			flex: 1;
			overflow-y: auto;

			.swiper-box {
				padding-top: 76rpx;
			}

			.person-msg-content {
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;

				.person-pic {
					width: 132rpx;
					height: 132rpx;
					background: #ffffff;
					border-radius: 50%;
					margin-top: 50rpx;
				}

				.person-name {
					font-weight: bold;
					font-size: 48rpx;
					color: #000000;
					margin-top: 24rpx;
				}

				.person-age-sex {
					font-weight: 500;
					font-size: 28rpx;
					color: #666666;
					margin-top: 8rpx;
					display: flex;

					>text {
						&:first-child {
							margin-left: 0;
						}

						display: block;
						margin-left: 24rpx;
					}
				}

				.person-desc {
					font-weight: 500;
					font-size: 28rpx;
					color: #999999;
					margin-top: 24rpx;
					padding: 0 48rpx;
					text-align: center;
					line-height: 44rpx;
				}
			}
		}

		.bottom-box {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 24rpx 48rpx;
			background-color: #ffffff;
			border-top: solid 2rpx #f6f6f6;

			.chat-btn {
				width: 466rpx;
				height: 96rpx;
				background: #fcd610;
				border-radius: 48rpx 48rpx 48rpx 48rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				font-weight: bold;
				font-size: 32rpx;
				color: #000000;
			}

			.group_5 {
				.text_8 {
					color: #ff7676;
					font-size: 24rpx;
				}

				.text_6 {
					color: #ff7676;
					font-size: 40rpx;
				}

				.text_9 {
					color: #999999;
					font-size: 24rpx;
					font-weight: 700;
				}
			}
		}
	}
</style>